#pragma once

#include <wx/wx.h>
#include <wx/ffile.h>
#include "dictdb/dictdbutils.h"

class Converter {
    public:
        Converter(const wxString& txtpath, const wxString& dictpath);
        virtual ~Converter() {
            _dictdb_utils.commit();
        };
        
        bool start();
        
    protected:
        
        int _read_line(wxString& line);
        
        int _set_dict_info();
        
        bool _add_word_to_dictdb(const wxString& str);
        
        const static int _MAX_BUFFER_SIZE = 204800;
        
        wxFFile _txtfile;
        
        DictDBUtils _dictdb_utils;
        int d_id;
        
        int _converted_words;
        
        char buffer[_MAX_BUFFER_SIZE];
        
        wxString dictname;
        wxString author;
        wxString license;
        wxString origLang;
        wxString destLang;
        wxString description;
        wxString email;
        wxString website;
        wxString version;
};
